<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>FabGL: ModelineStudio/ModelineStudio.ino</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">FabGL
   </div>
   <div id="projectbrief">ESP32 VGA Controller and Graphics Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_modeline_studio_2_modeline_studio_8ino-example.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">ModelineStudio/ModelineStudio.ino</div>  </div>
</div><!--header-->
<div class="contents">
<p>Test VGA output at predefined resolutions or custom resolution by specifying linux-like modelines</p>
<div class="fragment"><div class="line"><span class="comment">/*</span></div><div class="line"><span class="comment">  Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - www.fabgl.com</span></div><div class="line"><span class="comment">  Copyright (c) 2019 Fabrizio Di Vittorio.</span></div><div class="line"><span class="comment">  All rights reserved.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  This file is part of FabGL Library.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is free software: you can redistribute it and/or modify</span></div><div class="line"><span class="comment">  it under the terms of the GNU General Public License as published by</span></div><div class="line"><span class="comment">  the Free Software Foundation, either version 3 of the License, or</span></div><div class="line"><span class="comment">  (at your option) any later version.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  FabGL is distributed in the hope that it will be useful,</span></div><div class="line"><span class="comment">  but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div><div class="line"><span class="comment">  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div><div class="line"><span class="comment">  GNU General Public License for more details.</span></div><div class="line"><span class="comment"></span></div><div class="line"><span class="comment">  You should have received a copy of the GNU General Public License</span></div><div class="line"><span class="comment">  along with FabGL.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div><div class="line"><span class="comment"> */</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="preprocessor">#include &quot;<a class="code" href="fabgl_8h.html">fabgl.h</a>&quot;</span></div><div class="line"></div><div class="line"></div><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> * PresetResolutions[] = {</div><div class="line">  <a name="a0"></a><a class="code" href="fabglconf_8h.html#a79c16e345febd0d26723e122a4b939b4">VGA_256x384_60Hz</a>,</div><div class="line">  <a name="a1"></a><a class="code" href="fabglconf_8h.html#a053cde6629b66d4ba3e31e92af8861bb">VGA_320x200_75Hz</a>,</div><div class="line">  <a name="a2"></a><a class="code" href="fabglconf_8h.html#a9321d0294fbf5e167be1627b5660d933">QVGA_320x240_60Hz</a>,</div><div class="line">  <a name="a3"></a><a class="code" href="fabglconf_8h.html#a8052201f91850dfc935be639a91da6ee">VGA_400x300_60Hz</a>,</div><div class="line">  <a name="a4"></a><a class="code" href="fabglconf_8h.html#a6e68e4a75777e8962beec2fb37a4b1e0">VGA_480x300_75Hz</a>,</div><div class="line">  <a name="a5"></a><a class="code" href="fabglconf_8h.html#a8d89ffdbe287a195d0f62d4e12a31f36">VGA_512x384_60Hz</a>,</div><div class="line">  <a name="a6"></a><a class="code" href="fabglconf_8h.html#aad8f98eb11654d95f40f8b0f8ac1bf62">VGA_512x448_60Hz</a>,</div><div class="line">  <a name="a7"></a><a class="code" href="fabglconf_8h.html#aebe5d4fd9da20fc7ca153c8ade3938f5">VGA_512x512_58Hz</a>,</div><div class="line">  <a name="a8"></a><a class="code" href="fabglconf_8h.html#ac5e5d3057b7f87058c6191c87d9a1d54">VGA_640x200_70Hz</a>,</div><div class="line">  <a name="a9"></a><a class="code" href="fabglconf_8h.html#a8acc61f3b1a9d4c0be718b22fa05c767">VGA_640x240_60Hz</a>,</div><div class="line">  <a name="a10"></a><a class="code" href="fabglconf_8h.html#a4f3590c227bd5abf54fdad55450aa2b7">VGA_640x350_70Hz</a>,</div><div class="line">  <a name="a11"></a><a class="code" href="fabglconf_8h.html#ae913dffdd13bd77b79d1a253e88bf22f">VGA_640x350_70HzAlt1</a>,</div><div class="line">  <a name="a12"></a><a class="code" href="fabglconf_8h.html#a2e0bf63e5ba6bfe1badb621c235e3f9b">VESA_640x350_85Hz</a>,</div><div class="line">  <a name="a13"></a><a class="code" href="fabglconf_8h.html#afe328eafdaa469a1c68be7c38059efb8">VGA_640x382_60Hz</a>,</div><div class="line">  <a name="a14"></a><a class="code" href="fabglconf_8h.html#aa6b2ada76eb9e786172122175d019582">VGA_640x384_60Hz</a>,</div><div class="line">  <a name="a15"></a><a class="code" href="fabglconf_8h.html#a86b59f35df218823a6165d836cfc22c0">VGA_640x400_70Hz</a>,</div><div class="line">  <a name="a16"></a><a class="code" href="fabglconf_8h.html#a2d4571e9072b78877c36bf32bc9423f8">VGA_640x480_60Hz</a>,</div><div class="line">  <a name="a17"></a><a class="code" href="fabglconf_8h.html#a0a71a8ca2b76872336ace9a316dd8965">VGA_640x480_60HzAlt1</a>,</div><div class="line">  <a name="a18"></a><a class="code" href="fabglconf_8h.html#ad897c93be5d8d1d533f32b17aeb6d5c0">VGA_640x480_60HzD</a>,</div><div class="line">  <a name="a19"></a><a class="code" href="fabglconf_8h.html#a3dd5ee24424e059948701119687589e6">VGA_640x480_73Hz</a>,</div><div class="line">  <a name="a20"></a><a class="code" href="fabglconf_8h.html#addea82fe18c9c78642f2754141fbcc43">VESA_640x480_75Hz</a>,</div><div class="line">  <a name="a21"></a><a class="code" href="fabglconf_8h.html#aa25f5e5fe69b269367ac35791e502c03">VESA_720x400_85Hz</a>,</div><div class="line">  <a name="a22"></a><a class="code" href="fabglconf_8h.html#a78928748f0005d2888c16c0d562f6ca8">PAL_720x576_50Hz</a>,</div><div class="line">  <a name="a23"></a><a class="code" href="fabglconf_8h.html#a82f3c24fd89e8698ef7a729e0711690e">VESA_768x576_60Hz</a>,</div><div class="line">  <a name="a24"></a><a class="code" href="fabglconf_8h.html#a149ab7cf990772ba8a9148eb5dd6e4d6">SVGA_800x300_60Hz</a>,</div><div class="line">  <a name="a25"></a><a class="code" href="fabglconf_8h.html#a0eee2772f4d1f6601f4c2584857b513a">SVGA_800x600_56Hz</a>,</div><div class="line">  <a name="a26"></a><a class="code" href="fabglconf_8h.html#a2b508213a3ab1ad056d8c4e59b1708d3">SVGA_800x600_60Hz</a>,</div><div class="line">};</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> currentResolution = 11;  <span class="comment">// VGA_640x350_70HzAlt1</span></div><div class="line"><span class="keywordtype">int</span> moveX = 0;</div><div class="line"><span class="keywordtype">int</span> moveY = 0;</div><div class="line"><span class="keywordtype">int</span> shrinkX = 0;</div><div class="line"><span class="keywordtype">int</span> shrinkY = 0;</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> printHelp()</div><div class="line">{</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Modeline studio\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Chip Revision: %d   Chip Frequency: %d MHz\n\n&quot;</span>, ESP.getChipRevision(), ESP.getCpuFreqMHz());</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;%s\n&quot;</span>, VGAController.<a name="a27"></a>getResolutionTimings()-&gt;<a name="a28"></a><a class="code" href="structfabgl_1_1_timings.html#a5c58a215485ab067d287668666d266bf">label</a>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;\nScreen move:\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;  w = Move Up   z = Move Down   a = Move Left   s = Move Right\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Screen shrink:\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;  n = Dec Horiz N = Inc Horiz   m = Dec Vert    M = Inc Vert\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Resolutions:\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;  + = Next resolution  - = Prev resolution   x = Restore modeline\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Modeline change:\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;  ! = Insert modline. Example: !\&quot;640x350@70Hz\&quot; 25.175 640 656 752 800 350 366 462 510 -HSync -VSync\n&quot;</span>);</div><div class="line">  <span class="comment">/*</span></div><div class="line"><span class="comment">  Serial.printf(&quot;  e = Decrease horiz. Front Porch   E = Increase horiz. Front Porch\n&quot;);</span></div><div class="line"><span class="comment">  Serial.printf(&quot;  r = Decrease horiz. Sync Pulse    R = Increase horiz. Sync Pulse\n&quot;);</span></div><div class="line"><span class="comment">  Serial.printf(&quot;  t = Decrease horiz. Bach Porch    T = Increase horiz. Back Porch\n&quot;);</span></div><div class="line"><span class="comment">  Serial.printf(&quot;  y = Decrease vert. Front Porch    Y = Increase vert. Front Porch\n&quot;);</span></div><div class="line"><span class="comment">  Serial.printf(&quot;  u = Decrease vert. Sync Pulse     U = Increase vert. Sync Pulse\n&quot;);</span></div><div class="line"><span class="comment">  Serial.printf(&quot;  i = Decrease vert. Bach Porch     I = Increase vert. Back Porch\n&quot;);</span></div><div class="line"><span class="comment">  */</span></div><div class="line">  Serial.printf(<span class="stringliteral">&quot;  o = Decrease frequency by 5KHz    O = Increase frequency by 5KHz\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;  . = Change horiz. signals order\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Various:\n&quot;</span>);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;  h = Print This help\n\n&quot;</span>);</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> printInfo()</div><div class="line">{</div><div class="line">  <span class="keyword">auto</span> t = VGAController.getResolutionTimings();</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Modeline \&quot;%s\&quot; %2.8g %d %d %d %d %d %d %d %d %cHSync %cVSync %s %s\n&quot;</span>,</div><div class="line">                t-&gt;label,</div><div class="line">                t-&gt;frequency / 1000000.0,</div><div class="line">                t-&gt;HVisibleArea,</div><div class="line">                t-&gt;HVisibleArea + t-&gt;HFrontPorch,</div><div class="line">                t-&gt;HVisibleArea + t-&gt;HFrontPorch + t-&gt;HSyncPulse,</div><div class="line">                t-&gt;HVisibleArea + t-&gt;HFrontPorch + t-&gt;HSyncPulse + t-&gt;HBackPorch,</div><div class="line">                t-&gt;VVisibleArea,</div><div class="line">                t-&gt;VVisibleArea + t-&gt;VFrontPorch,</div><div class="line">                t-&gt;VVisibleArea + t-&gt;VFrontPorch + t-&gt;VSyncPulse,</div><div class="line">                t-&gt;VVisibleArea + t-&gt;VFrontPorch + t-&gt;VSyncPulse + t-&gt;VBackPorch,</div><div class="line">                t-&gt;HSyncLogic, t-&gt;VSyncLogic,</div><div class="line">                t-&gt;scanCount == 2 ? <span class="stringliteral">&quot;DoubleScan&quot;</span> : <span class="stringliteral">&quot;&quot;</span>,</div><div class="line">                t-&gt;HStartingBlock == <a name="a29"></a><a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a8a10612c141004c5f2986050c23a349d">ScreenBlock::FrontPorch</a> ? <span class="stringliteral">&quot;FrontPorchBegins&quot;</span> :</div><div class="line">                (t-&gt;HStartingBlock == <a name="a30"></a><a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a3883a8f6a8d0924e5083674b04d162e1">ScreenBlock::Sync</a> ? <span class="stringliteral">&quot;SyncBegins&quot;</span> :</div><div class="line">                (t-&gt;HStartingBlock == <a name="a31"></a><a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652aa2e3d51a4bdf436297de5d18f0fc7fc2">ScreenBlock::BackPorch</a> ? <span class="stringliteral">&quot;BackPorchBegins&quot;</span> : <span class="stringliteral">&quot;VisibleBegins&quot;</span>)));</div><div class="line"></div><div class="line">  <span class="comment">//Serial.printf(&quot;VFront = %d, VSync = %d, VBack = %d\n&quot;, t-&gt;VFrontPorch, t-&gt;VSyncPulse, t-&gt;VBackPorch);</span></div><div class="line"></div><div class="line">  <span class="keywordflow">if</span> (moveX || moveY)</div><div class="line">    Serial.printf(<span class="stringliteral">&quot;moveScreen(%d, %d)\n&quot;</span>, moveX, moveY);</div><div class="line">  <span class="keywordflow">if</span> (shrinkX || shrinkY)</div><div class="line">    Serial.printf(<span class="stringliteral">&quot;shrinkScreen(%d, %d)\n&quot;</span>, shrinkX, shrinkY);</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Screen size   : %d x %d\n&quot;</span>, VGAController.<a name="a32"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ad7310c48604f37aec2ea3274fefd405c">getScreenWidth</a>(), VGAController.<a name="a33"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#af3406190a30fc46070da0a7353da4082">getScreenHeight</a>());</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Viewport size : %d x %d\n&quot;</span>, Canvas.<a name="a34"></a><a class="code" href="classfabgl_1_1_canvas_class.html#aea413b9edfd1ba4d74289a7200bd2fe6">getWidth</a>(), Canvas.<a name="a35"></a><a class="code" href="classfabgl_1_1_canvas_class.html#abf1d0eae0cee9c7606b7a60c8f892ff5">getHeight</a>());</div><div class="line">  Serial.printf(<span class="stringliteral">&quot;Free memory (total, min, largest): %d, %d, %d\n\n&quot;</span>, heap_caps_get_free_size(MALLOC_CAP_DMA),</div><div class="line">                                                                   heap_caps_get_minimum_free_size(MALLOC_CAP_DMA),</div><div class="line">                                                                   heap_caps_get_largest_free_block(MALLOC_CAP_DMA));</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> updateScreen()</div><div class="line">{</div><div class="line">  Canvas.<a name="a36"></a><a class="code" href="classfabgl_1_1_canvas_class.html#a8dbddce234790b290cb4bd053dc0e701">setPenColor</a>(<a name="a37"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3ba810c94a5121684c7ef87d3ad25921ae2">Color::BrightRed</a>);</div><div class="line">  Canvas.<a name="a38"></a><a class="code" href="classfabgl_1_1_canvas_class.html#a9cec8cd2eb3f498b67ec7f20800131da">setBrushColor</a>(<a name="a39"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3ba5e8c133693ddc8c4fea104605f2154b8">Color::BrightBlue</a>);</div><div class="line">  Canvas.<a name="a40"></a><a class="code" href="classfabgl_1_1_canvas_class.html#a37beec4d52526d2710d47d911a1cd8c2">clear</a>();</div><div class="line">  Canvas.<a name="a41"></a><a class="code" href="classfabgl_1_1_canvas_class.html#a003aeb0b8e58b5e0e658e2f18c106fef">fillRectangle</a>(0, 0, Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#aea413b9edfd1ba4d74289a7200bd2fe6">getWidth</a>() - 1, Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#abf1d0eae0cee9c7606b7a60c8f892ff5">getHeight</a>() - 1);</div><div class="line">  Canvas.<a name="a42"></a><a class="code" href="classfabgl_1_1_canvas_class.html#ae3c576f40f28789d5b11e622e2c1021c">drawRectangle</a>(0, 0, Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#aea413b9edfd1ba4d74289a7200bd2fe6">getWidth</a>() - 1, Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#abf1d0eae0cee9c7606b7a60c8f892ff5">getHeight</a>() - 1);</div><div class="line"></div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a8dbddce234790b290cb4bd053dc0e701">setPenColor</a>(<a name="a43"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3bab097ba4cce4536843fc9a93b5d7a5af0">Color::Black</a>);</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a9cec8cd2eb3f498b67ec7f20800131da">setBrushColor</a>(<a name="a44"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3baa598524eec0f8d9ba493f37390a48d12">Color::BrightYellow</a>);</div><div class="line">  Canvas.<a name="a45"></a><a class="code" href="classfabgl_1_1_canvas_class.html#aec16bab7318419fde24db0b9a78d3281">selectFont</a>(Canvas.<a name="a46"></a><a class="code" href="classfabgl_1_1_canvas_class.html#aae47e5f03e69ed21dd07f4b73e43e4f0">getPresetFontInfo</a>(40, 14));</div><div class="line">  Canvas.<a name="a47"></a><a class="code" href="classfabgl_1_1_canvas_class.html#a4e8cfc8e0e279de0defc88d8e01443dc">setGlyphOptions</a>(GlyphOptions().FillBackground(<span class="keyword">true</span>).DoubleWidth(1));</div><div class="line">  Canvas.<a name="a48"></a><a class="code" href="classfabgl_1_1_canvas_class.html#a7e53c87e27387e1849e9439880d03e44">drawText</a>(40, 20, VGAController.getResolutionTimings()-&gt;<a class="code" href="structfabgl_1_1_timings.html#a5c58a215485ab067d287668666d266bf">label</a>);</div><div class="line"></div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a4e8cfc8e0e279de0defc88d8e01443dc">setGlyphOptions</a>(GlyphOptions());</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a8dbddce234790b290cb4bd053dc0e701">setPenColor</a>(<a name="a49"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3babd066cc7f08ecfdd34e59e9d5348ae67">Color::BrightWhite</a>);</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a9cec8cd2eb3f498b67ec7f20800131da">setBrushColor</a>(<a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3ba5e8c133693ddc8c4fea104605f2154b8">Color::BrightBlue</a>);</div><div class="line">  Canvas.<a name="a50"></a><a class="code" href="classfabgl_1_1_canvas_class.html#a45b0f278e677b6195ccea7bc377fe8c5">drawTextFmt</a>(40, 40, <span class="stringliteral">&quot;Screen Size   : %d x %d&quot;</span>, VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ad7310c48604f37aec2ea3274fefd405c">getScreenWidth</a>(), VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#af3406190a30fc46070da0a7353da4082">getScreenHeight</a>());</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a45b0f278e677b6195ccea7bc377fe8c5">drawTextFmt</a>(40, 60, <span class="stringliteral">&quot;Viewport Size : %d x %d&quot;</span>, Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#aea413b9edfd1ba4d74289a7200bd2fe6">getWidth</a>(), Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#abf1d0eae0cee9c7606b7a60c8f892ff5">getHeight</a>());</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a7e53c87e27387e1849e9439880d03e44">drawText</a>(40, 80,    <span class="stringliteral">&quot;Commands (More on UART):&quot;</span>);</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a7e53c87e27387e1849e9439880d03e44">drawText</a>(40, 100,   <span class="stringliteral">&quot;  w = Move Up    z = Move Down&quot;</span>);</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a7e53c87e27387e1849e9439880d03e44">drawText</a>(40, 120,   <span class="stringliteral">&quot;  a = Move Left  s = Move Right&quot;</span>);</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a7e53c87e27387e1849e9439880d03e44">drawText</a>(40, 140,   <span class="stringliteral">&quot;  + = Next Resolution&quot;</span>);</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#a8dbddce234790b290cb4bd053dc0e701">setPenColor</a>(<a name="a51"></a><a class="code" href="group___enumerations.html#gga843f6f6094fb6666d0e726d7b0e06f3baf09d081210f708ef088785200c5c616e">Color::BrightGreen</a>);</div><div class="line">  Canvas.<a class="code" href="classfabgl_1_1_canvas_class.html#ae3c576f40f28789d5b11e622e2c1021c">drawRectangle</a>(35, 15, 295, 155);</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> setup()</div><div class="line">{</div><div class="line">  Serial.begin(115200);</div><div class="line"></div><div class="line">  <span class="comment">// avoid garbage into the UART</span></div><div class="line">  delay(500);</div><div class="line"></div><div class="line">  VGAController.<a name="a52"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#acdc8b95372c01a76deeb4abe360d0295">begin</a>();</div><div class="line">  VGAController.<a name="a53"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ac190a844ead4bb68817c733fb0c9a5af">setResolution</a>(PresetResolutions[currentResolution]);</div><div class="line">  updateScreen();</div><div class="line">  printHelp();</div><div class="line">  printInfo();</div><div class="line">}</div><div class="line"></div><div class="line"></div><div class="line"><span class="keywordtype">void</span> loop()</div><div class="line">{</div><div class="line">  <a name="_a54"></a><a class="code" href="structfabgl_1_1_timings.html">fabgl::Timings</a> t;</div><div class="line"></div><div class="line">  <span class="keywordflow">if</span> (Serial.available() &gt; 0) {</div><div class="line">    <span class="keywordtype">char</span> c = Serial.read();</div><div class="line">    <span class="keywordflow">switch</span> (c) {</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;h&#39;</span>:</div><div class="line">        printHelp();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;w&#39;</span>:</div><div class="line">        --moveY;</div><div class="line">        VGAController.<a name="a55"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#a16843256aeff799ff96654cef6a231e7">moveScreen</a>(0, -1);</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;z&#39;</span>:</div><div class="line">        ++moveY;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#a16843256aeff799ff96654cef6a231e7">moveScreen</a>(0, +1);</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;a&#39;</span>:</div><div class="line">        --moveX;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#a16843256aeff799ff96654cef6a231e7">moveScreen</a>(-1, 0);</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;s&#39;</span>:</div><div class="line">        ++moveX;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#a16843256aeff799ff96654cef6a231e7">moveScreen</a>(+1, 0);</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;x&#39;</span>:</div><div class="line">        moveX = moveY = shrinkX = shrinkY = 0;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ac190a844ead4bb68817c733fb0c9a5af">setResolution</a>(PresetResolutions[currentResolution]);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;+&#39;</span>:</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;-&#39;</span>:</div><div class="line">        moveX = moveY = shrinkX = shrinkY = 0;</div><div class="line">        currentResolution = (c == <span class="charliteral">&#39;+&#39;</span> ? currentResolution + 1 : currentResolution - 1);</div><div class="line">        <span class="keywordflow">if</span> (currentResolution == <span class="keyword">sizeof</span>(PresetResolutions) / <span class="keyword">sizeof</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *))</div><div class="line">          currentResolution = 0;</div><div class="line">        <span class="keywordflow">if</span> (currentResolution &lt; 0)</div><div class="line">          currentResolution = <span class="keyword">sizeof</span>(PresetResolutions) / <span class="keyword">sizeof</span>(<span class="keyword">const</span> <span class="keywordtype">char</span> *) - 1;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ac190a844ead4bb68817c733fb0c9a5af">setResolution</a>(PresetResolutions[currentResolution]);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;!&#39;</span>:</div><div class="line">        moveX = moveY = shrinkX = shrinkY = 0;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ac190a844ead4bb68817c733fb0c9a5af">setResolution</a>( Serial.readStringUntil(<span class="charliteral">&#39;\n&#39;</span>).c_str() );</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="comment">/*</span></div><div class="line"><span class="comment">      case &#39;e&#39;:</span></div><div class="line"><span class="comment">      case &#39;E&#39;:</span></div><div class="line"><span class="comment">        t = *VGAController.getResolutionTimings();</span></div><div class="line"><span class="comment">        t.HFrontPorch = (c == &#39;e&#39; ? t.HFrontPorch - 1 : t.HFrontPorch + 1);</span></div><div class="line"><span class="comment">        VGAController.setResolution(t);</span></div><div class="line"><span class="comment">        updateScreen();</span></div><div class="line"><span class="comment">        printInfo();</span></div><div class="line"><span class="comment">        break;</span></div><div class="line"><span class="comment">      case &#39;r&#39;:</span></div><div class="line"><span class="comment">      case &#39;R&#39;:</span></div><div class="line"><span class="comment">        t = *VGAController.getResolutionTimings();</span></div><div class="line"><span class="comment">        t.HSyncPulse = (c == &#39;r&#39; ? t.HSyncPulse - 1 : t.HSyncPulse + 1);</span></div><div class="line"><span class="comment">        VGAController.setResolution(t);</span></div><div class="line"><span class="comment">        updateScreen();</span></div><div class="line"><span class="comment">        printInfo();</span></div><div class="line"><span class="comment">        break;</span></div><div class="line"><span class="comment">      case &#39;t&#39;:</span></div><div class="line"><span class="comment">      case &#39;T&#39;:</span></div><div class="line"><span class="comment">        t = *VGAController.getResolutionTimings();</span></div><div class="line"><span class="comment">        t.HBackPorch = (c == &#39;t&#39; ? t.HBackPorch - 1 : t.HBackPorch + 1);</span></div><div class="line"><span class="comment">        VGAController.setResolution(t);</span></div><div class="line"><span class="comment">        updateScreen();</span></div><div class="line"><span class="comment">        printInfo();</span></div><div class="line"><span class="comment">        break;</span></div><div class="line"><span class="comment">      case &#39;y&#39;:</span></div><div class="line"><span class="comment">      case &#39;Y&#39;:</span></div><div class="line"><span class="comment">        t = *VGAController.getResolutionTimings();</span></div><div class="line"><span class="comment">        t.VFrontPorch = (c == &#39;y&#39; ? t.VFrontPorch - 1 : t.VFrontPorch + 1);</span></div><div class="line"><span class="comment">        VGAController.setResolution(t);</span></div><div class="line"><span class="comment">        updateScreen();</span></div><div class="line"><span class="comment">        printInfo();</span></div><div class="line"><span class="comment">        break;</span></div><div class="line"><span class="comment">      case &#39;u&#39;:</span></div><div class="line"><span class="comment">      case &#39;U&#39;:</span></div><div class="line"><span class="comment">        t = *VGAController.getResolutionTimings();</span></div><div class="line"><span class="comment">        t.VSyncPulse = (c == &#39;u&#39; ? t.VSyncPulse - 1 : t.VSyncPulse + 1);</span></div><div class="line"><span class="comment">        VGAController.setResolution(t);</span></div><div class="line"><span class="comment">        updateScreen();</span></div><div class="line"><span class="comment">        printInfo();</span></div><div class="line"><span class="comment">        break;</span></div><div class="line"><span class="comment">      case &#39;i&#39;:</span></div><div class="line"><span class="comment">      case &#39;I&#39;:</span></div><div class="line"><span class="comment">        t = *VGAController.getResolutionTimings();</span></div><div class="line"><span class="comment">        t.VBackPorch = (c == &#39;i&#39; ? t.VBackPorch - 1 : t.VBackPorch + 1);</span></div><div class="line"><span class="comment">        VGAController.setResolution(t);</span></div><div class="line"><span class="comment">        updateScreen();</span></div><div class="line"><span class="comment">        printInfo();</span></div><div class="line"><span class="comment">        break;</span></div><div class="line"><span class="comment">      */</span></div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;o&#39;</span>:</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;O&#39;</span>:</div><div class="line">        t = *VGAController.getResolutionTimings();</div><div class="line">        t.<a name="a56"></a><a class="code" href="structfabgl_1_1_timings.html#ab5a1e083cc181419b327dca5508c5b65">frequency</a> = (c == <span class="charliteral">&#39;o&#39;</span> ? t.<a class="code" href="structfabgl_1_1_timings.html#ab5a1e083cc181419b327dca5508c5b65">frequency</a> - 5000 : t.<a class="code" href="structfabgl_1_1_timings.html#ab5a1e083cc181419b327dca5508c5b65">frequency</a> + 5000);</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ac190a844ead4bb68817c733fb0c9a5af">setResolution</a>(t);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;.&#39;</span>:</div><div class="line">        t = *VGAController.getResolutionTimings();</div><div class="line">        <span class="keywordflow">switch</span> (t.<a name="a57"></a><a class="code" href="structfabgl_1_1_timings.html#a7a93d01c54b2cb9b07c328d0dc1b0334">HStartingBlock</a>) {</div><div class="line">          <span class="keywordflow">case</span> <a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a8a10612c141004c5f2986050c23a349d">ScreenBlock::FrontPorch</a>:</div><div class="line">            t.<a class="code" href="structfabgl_1_1_timings.html#a7a93d01c54b2cb9b07c328d0dc1b0334">HStartingBlock</a> = <a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a3883a8f6a8d0924e5083674b04d162e1">ScreenBlock::Sync</a>;</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">          <span class="keywordflow">case</span> <a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a3883a8f6a8d0924e5083674b04d162e1">ScreenBlock::Sync</a>:</div><div class="line">            t.<a class="code" href="structfabgl_1_1_timings.html#a7a93d01c54b2cb9b07c328d0dc1b0334">HStartingBlock</a> = <a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652aa2e3d51a4bdf436297de5d18f0fc7fc2">ScreenBlock::BackPorch</a>;</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">          <span class="keywordflow">case</span> <a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652aa2e3d51a4bdf436297de5d18f0fc7fc2">ScreenBlock::BackPorch</a>:</div><div class="line">            t.<a class="code" href="structfabgl_1_1_timings.html#a7a93d01c54b2cb9b07c328d0dc1b0334">HStartingBlock</a> = <a name="a58"></a><a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a9eb43f64e3e327a4e68f4537db8e0582">ScreenBlock::VisibleArea</a>;</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">          <span class="keywordflow">case</span> <a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a9eb43f64e3e327a4e68f4537db8e0582">ScreenBlock::VisibleArea</a>:</div><div class="line">            t.<a class="code" href="structfabgl_1_1_timings.html#a7a93d01c54b2cb9b07c328d0dc1b0334">HStartingBlock</a> = <a class="code" href="group___enumerations.html#ggac9fa12697d1785c744af01bb0800d652a8a10612c141004c5f2986050c23a349d">ScreenBlock::FrontPorch</a>;</div><div class="line">            <span class="keywordflow">break</span>;</div><div class="line">        }</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#ac190a844ead4bb68817c733fb0c9a5af">setResolution</a>(t);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;n&#39;</span>:</div><div class="line">        ++shrinkX;</div><div class="line">        VGAController.<a name="a59"></a><a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#affb399316e3a45b6b3ae601544dbc3a9">shrinkScreen</a>(+1, 0);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;N&#39;</span>:</div><div class="line">        --shrinkX;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#affb399316e3a45b6b3ae601544dbc3a9">shrinkScreen</a>(-1, 0);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;m&#39;</span>:</div><div class="line">        ++shrinkY;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#affb399316e3a45b6b3ae601544dbc3a9">shrinkScreen</a>(0, +1);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">      <span class="keywordflow">case</span> <span class="charliteral">&#39;M&#39;</span>:</div><div class="line">        --shrinkY;</div><div class="line">        VGAController.<a class="code" href="classfabgl_1_1_v_g_a_controller_class.html#affb399316e3a45b6b3ae601544dbc3a9">shrinkScreen</a>(0, -1);</div><div class="line">        updateScreen();</div><div class="line">        printInfo();</div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">    }</div><div class="line">  }</div><div class="line">}</div></div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
